import java.util.Arrays;
import java.util.Comparator;

public class Main {
    public static void BubbleSort(Comparable[] compare){
        for (int i = 0; i < compare.length-1; i++) {//表示比较的趟数
            for (int j = 0; j < compare.length-1-i; j++) {
                if(compare[j].compareTo(compare[j+1]) > 0){
                    Comparable temp = compare[j];
                    compare[j] = compare[j+1];
                    compare[j+1] = temp;
                }
            }
        }
    }

    public static void main(String[] args) {
        Student[] stu = new Student[3];
        stu[0] = new Student(10);
        stu[1] = new Student(8);
        stu[2] = new Student(11);

        BubbleSort(stu);
        System.out.println(Arrays.toString(stu));
    }
}
